<?php

class panel_menubar extends QPanel {

    public $bool_logined=false;
    public $bool_mode_login=false;
    public $bool_mode_register=false;
    public $bool_mode_forgot=false;

    //login
    public $textfield_login_username;
    public $textfield_login_password;
    public $button_login;

    //register
    public $textfield_register_username;
    public $textfield_register_email;
    public $button_register;

    //forgot
    public $textfield_forgot_username;
    public $textfield_forgot_birth;
    public $button_forgot;

    public $label_message;


    public function __construct($objParentObject, $strControlId = null) {
        // First, let's call the Parent's __constructor
        try {
            parent::__construct($objParentObject, $strControlId);
        } catch (QCallerException $objExc) {
            $objExc->IncrementOffset();
            throw $objExc;
        }
        //login
        $this->textfield_login_username_Create();
        $this->textfield_login_password_Create();
        $this->button_login_Create();

        //register
        $this->textfield_register_username_Create();
        $this->textfield_register_email_Create();
        $this->button_register_Create();

        $this->label_message_Create();

    }

    public function hide_all_controls()
    {
        $this->textfield_login_username->Visible=false;
        $this->textfield_login_password->Visible=false;
        $this->button_login->Visible=false;
        $this->textfield_register_username->Visible=false;
        $this->textfield_register_email->Visible=false;
        $this->button_register->Visible=false;
        //$this->textfield_forgot_username->Visible=false;
        //$this->textfield_forgot_birth->Visible=false;
        //$this->button_forgot->Visible=false;
    }

    protected function label_message_Create() {
        $this->label_message = new QLabel($this);
        $this->label_message->Text = '';
        //$this->label_message->AddAction(new QClickEvent(), new QServerAction('login_Click'));
        //$this->button_login->PrimaryButton = true;
        //$this->button_login->CausesValidation = true;
        //$this->button_login->Visible=false;
    }

    //login
    protected function textfield_login_username_Create() {
        $this->textfield_login_username = new QTextBox($this);
        //$this->textfield_login_username->Name = 'username:';
        $this->textfield_login_username->MaxLength=30;
        $this->textfield_login_username->Width=120;
        $this->textfield_login_username->CssClass = 'input';
        //if(!$this->objParentControl->$bool_mode_login)$this->textfield_login_username->Visible=false;
    }

    protected function textfield_login_password_Create() {
        $this->textfield_login_password = new QTextBox($this);
        //$this->textfield_login_password->Name = 'password:';
        $this->textfield_login_password->MaxLength=200;
        $this->textfield_login_password->Width=120;
        $this->textfield_login_password->CssClass = 'input';
        //$this->textfield_login_password->Visible=false;
    }

    protected function button_login_Create() {
        $this->button_login = new QButton($this);
        $this->button_login->Text = 'Login';
        $this->button_login->AddAction(new QClickEvent(), new QServerAction('login_Click'));
        $this->button_login->PrimaryButton = true;
        //$this->button_login->CausesValidation = true;
        //$this->button_login->Visible=false;
    }

    //register
    protected function textfield_register_username_Create() {
        $this->textfield_register_username = new QTextBox($this);
        //$this->textfield_register_username->Name = 'username:';
        $this->textfield_register_username->MaxLength=30;
        $this->textfield_register_username->Width=120;
        $this->textfield_register_username->CssClass = 'input';
        //$this->textfield_register_username->Visible=false;
    }

    protected function textfield_register_email_Create() {
        $this->textfield_register_email = new QTextBox($this);
        //$this->textfield_register_email->Name = 'email:';
        $this->textfield_register_email->MaxLength=200;
        $this->textfield_register_email->Width=120;
        $this->textfield_register_email->CssClass = 'input';
        //$this->textfield_register_email->Visible=false;
    }

    protected function button_register_Create() {
        $this->button_register = new QButton($this);
        $this->button_register->Text = 'register';
        $this->button_register->AddAction(new QClickEvent(), new QServerAction('register_Click'));
        //$this->button_register->PrimaryButton = true;
        //$this->button_register->CausesValidation = true;
        $this->button_register->Visible=false;
    }

    //test
    /*protected function RedirectToListPage() {
        //QApplication::Redirect(__VIRTUAL_DIRECTORY__ . '/index_2.php');
        QApplication::Redirect(QApplication::$RequestUri);
    }

    //action
    public function login_Click($strFormId, $strControlId, $strParameter) {

        QApplication::Redirect(QApplication::$RequestUri.'?login');
    }*/
}

?>